<?php

namespace Xrfg\Core\Trading\Account\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * Xrfg\Core\Trading\Account\Models\Withdraw.
 *
 * @property int                                                                                     $id
 * @property int                                                                                     $user_id     用户ID
 * @property int                                                                                     $coin_id     币种ID
 * @property string|null                                                                             $hash        区块链交易ID
 * @property float                                                                                   $number      提现数量
 * @property float                                                                                   $fee         提现手续费
 * @property string                                                                                  $address     提现地址
 * @property string|null                                                                             $note        地址备注
 * @property string|null                                                                             $tag         地址标签
 * @property int|null                                                                                $status      提现状态: 0:审核中 1:已到账 2:已撤销 3:审核通过未处理 4:处理中
 * @property \Illuminate\Support\Carbon|null                                                         $created_at  提现时间
 * @property \Illuminate\Support\Carbon|null                                                         $updated_at  到账时间
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Withdraw newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Withdraw newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Withdraw query()
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Withdraw whereAddress($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Withdraw whereCoinId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Withdraw whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Withdraw whereFee($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Withdraw whereHash($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Withdraw whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Withdraw whereNote($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Withdraw whereNumber($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Withdraw whereStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Withdraw whereTag($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Withdraw whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Withdraw whereUserId($value)
 * @mixin \Eloquent
 * @property int|null $is_usdt_erc20 是否为USDT的ERC20提币地址:0-不是 1-是
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Withdraw whereIsUsdtErc20($value)
 * @property int|null $is_usdt_trc20 是否为USDT的TRC20提币地址:0-不是 1-是
 * @method static \Illuminate\Database\Eloquent\Builder|\Xrfg\Core\Trading\Account\Models\Withdraw whereIsUsdtTrc20($value)
 */
class Withdraw extends Model
{
    protected $table = 'trading_withdraws';

    /**
     * @var int 类编码
     */
    const CLASS_ID = 2;
    /**
     * @var int 操作编码：提现申请
     */
    const OP_APPLY = 1;
    /**
     * @var int 操作编码：提现成功
     */
    const OP_SUCCESS = 2;
    /**
     * @var int 操作编码：提现撤销
     */
    const OP_CANCEL = 3;

    // 审核中
    const STATUS_CHECKING = 0;
    // 已完成
    const STATUS_SUCCESS = 1;
    // 已撤销
    const STATUS_CANCEL = 2;
    // 审核通过未处理
    const STATUS_WAITING = 3;
    // 处理中
    const STATUS_PENDING = 4;

    public function number()
    {
        return $this->number - $this->fee;
    }
}
